' Bubble sort algorithm by Charlie Veniot
' This program exported from BASIC Anywhere Machine (Version [5.2.3].[2023.08.08.01.01]) on 2023.08.13 at 15:09 (Coordinated Universal Time)
OPTION BASE 1
DIM a$(4)
CLS
FOR i = 1 TO 4 : READ a$(i) : NEXT i
PRINT "Before sort:"
FOR i = 1 TO 4
PRINT a$(i)
NEXT i
FOR idx1 = 1 TO 3
FOR idx2 = 1 TO 3
IF a$(idx2+1) < a$(idx2) THEN SWAP a$(idx2), a$(idx2+1)
NEXT idx2
NEXT idx1
PRINT
PRINT "After sort:"
FOR i = 1 TO 4 : PRINT a$(i) : NEXT i
END
DATA Apple,Grape,Orange,Banana